//
//  BezierView.h
//  DebugDemo
//
//  Created by XFB on 2019/5/13.
//  Copyright © 2019 ZhouCheng. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSInteger, LineType) {
    LineType_Straight,  // 直线
    LineType_Curve      // 曲线
};

@interface BezierView : UIView

/// 线形图
- (void)drawLineViewWithX_Values_Names:(NSMutableArray *)x_names
                              y_values:(NSMutableArray *)y_values
                              lineType:(LineType)lineType
                        gradientColors:(NSArray *)gradientColors;

/// 柱状图
- (void)drawBarChartViewWithX_Values_Names:(NSMutableArray *)x_names
                                  y_values:(NSMutableArray *)y_values;

/// 饼状图
- (void)drawPieChartViewWithX_Values_Names:(NSMutableArray *)x_names
                                  y_values:(NSMutableArray *)y_values;


/*
 /// 4、添加目标值文字
 for (NSInteger i = 0; i < allPoints.count; i ++) {
 UILabel *label = [[UILabel alloc] init];
 label.textColor = [UIColor purpleColor];
 label.textAlignment = NSTextAlignmentCenter;
 label.font = [UIFont systemFontOfSize:10];
 [self.subviews[0] addSubview:label];
 
 if (i == 0) {
 CGPoint nowPoint = [allPoints[0] CGPointValue];
 label.text = [NSString stringWithFormat:@"%.01f", (CGRectGetHeight(bezierFrame)-nowPoint.y-30)/2];
 label.frame = CGRectMake(nowPoint.x-30/2, nowPoint.y-20, 30, 20);
 presentPoint = nowPoint;
 } else {
 CGPoint nowPoint = [allPoints[i] CGPointValue];
 if (nowPoint.y < presentPoint.y) {
 // 文字置于点上方
 label.frame = CGRectMake(nowPoint.x-30/2, nowPoint.y-20, 30, 20);
 } else {
 // 文字置于点下方
 label.frame = CGRectMake(nowPoint.x-30/2, nowPoint.y, 30, 20);
 }
 label.text = [NSString stringWithFormat:@"%.01f", (CGRectGetHeight(bezierFrame)-nowPoint.y-30)/2];
 presentPoint = nowPoint;
 }
 }
 */

@end

NS_ASSUME_NONNULL_END
